+2005-08-21 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl-classes.h: reindent, some documentation.
+ * babl/babl-fish.c: (babl_fish_reference_new): assertions for
+ arguments.
+ * babl/babl-ids.h: cleanup.
+ * babl/base/babl-base.c: (models): grayscale->gray
+ * babl/base/model-grayscale.c: (babl_base_model_gray),
+ (components), (models), (rgb_to_gray), (rgb_to_gray_2_2),
+ (gray_2_2_to_rgb), (gray_to_rgb),
+ (gray_alpha_premultiplied_to_rgba),
+ (rgba_to_gray_alpha_premultiplied), (conversions): grayscale->gray,
+ added gamma-2.2 with alpha.
+ * babl/base/model-lab.c:
+ * babl/base/model-rgb.c:
+ * babl/base/model-ycbcr.c: Name normalizations
+ * tests/float_to_u8.c: (test_float_to_rgb_u8):
+ * tests/grayscale_to_rgb.c: (test):
+ * tests/rgb_to_lab_to_rgb.c: (test):
+ * tests/rgb_to_ycbcr.c: (test):
+ * tests/rgb_to_ycbcr_to_rgb.c: (test):
+ * tests/u8_to_float.c: (test): Name synchronization.
+
2005-08-18 Øyvind Kolås <pippin@gimp.org>
* babl/base/util.h: added new and hopefully correct gamma correction
} BablInstance;
typedef struct
-{
+BablConversion {
BablInstance instance;
union Babl *source;
union Babl *destination;
} function;
} BablConversion;
-typedef struct
-{
- BablConversion conversion;
+typedef struct {
+ BablConversion conversion;
+ BablConversion *from_double;
+ BablConversion *to_double;
} BablConversionType;
typedef struct
union Babl *destination;
} BablFish;
+
+/* a BablFish which is a reference babl fish relies on the double
+ * versions that are required to exist for maximum sanity.
+ *
+ * A BablFishReference is not intended to be fast, thus the algorithm
+ * encoded can use a multi stage approach, where some of the stages could
+ * be completely removed for optimization reasons.
+ *
+ * This is not the intention of the "BablFishReference factory", it's
+ * implementation is meant to be kept as small as possible wrt logic.
+ *
+ * One of the contributions that would be welcome are new fish factories.
+ */
+
+
typedef struct
{
BablFish fish;
+
BablConversion *type_to_double;
BablConversion *model_to_rgba;
BablConversion *rgba_to_model;
assert (BABL_IS_BABL (source));
assert (BABL_IS_BABL (destination));
+ assert (source->class_type == BABL_PIXEL_FORMAT ||
+ source->class_type == BABL_MODEL);
+ assert (destination->class_type == BABL_PIXEL_FORMAT ||
+ destination->class_type == BABL_MODEL);
+
babl = babl_calloc (sizeof (BablFishReference), 1);
babl->class_type = BABL_FISH_REFERENCE;
babl->instance.id = 0;
babl->instance.name = NULL;
babl->fish.source = (union Babl*)source;
babl->fish.destination = (union Babl*)destination;
-
- babl->reference_fish.type_to_double =
- babl_conversion_find (
- source->pixel_format.type[0],
- babl_type_id (BABL_DOUBLE)
- );
-
- babl->reference_fish.model_to_rgba =
- babl_conversion_find (
- source->pixel_format.model[0],
- babl_model_id (BABL_RGBA)
- );
-
- babl->reference_fish.rgba_to_model =
- babl_conversion_find (
- babl_model_id (BABL_RGBA),
- destination->pixel_format.model[0]
- );
-
- babl->reference_fish.double_to_type =
- babl_conversion_find (
- babl_type_id (BABL_DOUBLE),
- destination->pixel_format.type[0]
- );
+
+ if (source->class_type == BABL_PIXEL_FORMAT)
+ {
+ babl->reference_fish.type_to_double =
+ babl_conversion_find (
+ source->pixel_format.type[0],
+ babl_type_id (BABL_DOUBLE)
+ );
+
+ babl->reference_fish.model_to_rgba =
+ babl_conversion_find (
+ source->pixel_format.model[0],
+ babl_model_id (BABL_RGBA)
+ );
+
+ babl->reference_fish.rgba_to_model =
+ babl_conversion_find (
+ babl_model_id (BABL_RGBA),
+ destination->pixel_format.model[0]
+ );
+
+ babl->reference_fish.double_to_type =
+ babl_conversion_find (
+ babl_type_id (BABL_DOUBLE),
+ destination->pixel_format.type[0]
+ );
+ }
+ else if (source->class_type == BABL_MODEL)
+ {
+ babl->reference_fish.type_to_double = NULL;
+
+
+ babl->reference_fish.model_to_rgba =
+ babl_conversion_find (
+ source->pixel_format.model[0],
+ babl_model_id (BABL_RGBA)
+ );
+
+ babl->reference_fish.rgba_to_model =
+ babl_conversion_find (
+ babl_model_id (BABL_RGBA),
+ destination->pixel_format.model[0]
+ );
+
+ babl->reference_fish.double_to_type =
+ babl_conversion_find (
+ babl_type_id (BABL_DOUBLE),
+ destination->pixel_format.type[0]
+ );
+ }
if (db_insert (babl) == babl)
{
BABL_GREEN,
BABL_BLUE,
BABL_ALPHA,
- BABL_LUMINANCE,
- BABL_LUMINANCE_GAMMA_2_2,
- BABL_LUMINANCE_MUL_ALPHA,
BABL_RED_MUL_ALPHA,
BABL_GREEN_MUL_ALPHA,
BABL_BLUE_MUL_ALPHA,
BABL_RED_GAMMA_2_2,
BABL_GREEN_GAMMA_2_2,
BABL_BLUE_GAMMA_2_2,
+ BABL_LUMINANCE,
+ BABL_LUMINANCE_GAMMA_2_2,
+ BABL_LUMINANCE_MUL_ALPHA,
+ BABL_X,
+ BABL_Y,
+ BABL_Z,
+ BABL_LAB_L,
+ BABL_LAB_A,
+ BABL_LAB_B,
+ BABL_CB,
+ BABL_CR,
BABL_CYAN,
BABL_MAGENTA,
BABL_YELLOW,
BABL_KEY,
- BABL_CB,
- BABL_CR,
- BABL_LAB_L,
- BABL_LAB_A,
- BABL_LAB_B,
- BABL_X,
- BABL_Y,
- BABL_Z,
BABL_Z_BUFFER,
BABL_PADDING,
BABL_MODEL_BASE = 10000,
BABL_RGB,
- BABL_RGB_GAMMA_2_2,
BABL_RGBA,
+ BABL_RGB_GAMMA_2_2,
BABL_RGBA_GAMMA_2_2,
BABL_RGBA_PREMULTIPLIED,
- BABL_GRAYSCALE,
- BABL_GRAYSCALE_GAMMA_2_2,
- BABL_GRAYSCALE_ALPHA,
- BABL_GRAYSCALE_ALPHA_PREMULTIPLIED,
+ BABL_GRAY,
+ BABL_GRAY_ALPHA,
+ BABL_GRAY_GAMMA_2_2,
+ BABL_GRAY_GAMMA_2_2_ALPHA,
+ BABL_GRAY_ALPHA_PREMULTIPLIED,
BABL_YCBCR,
- BABL_YCBCRA,
+ BABL_YCBCR_ALPHA,
BABL_LAB,
BABL_LAB_ALPHA,
BABL_CMY,
BABL_CMYK,
- BABL_CMYKA,
+ BABL_CMYK_ALPHA,
BABL_PIXEL_FORMAT_BASE = 100000,
BABL_SRGB,
BABL_RGB_FLOAT,
BABL_RGBA_FLOAT,
BABL_RGBA_DOUBLE,
- BABL_CMYK_FLOAT,
- BABL_CMYKA_FLOAT,
+ BABL_LAB_FLOAT,
BABL_YUV420,
-#if 0
BABL_RGB_U8,
BABL_RGBA_U8,
BABL_RGBA_U16,
- BABL_RGBA_FLOAT,
+ BABL_CMYK_FLOAT,
+ BABL_CMYK_ALPHA_FLOAT,
BABL_YUV411,
BABL_YUV422,
-#endif
BABL_PIXEL_USER_BASE,
};
* models
*/
-void babl_base_model_rgb (void);
-void babl_base_model_grayscale (void);
-void babl_base_model_ycbcr (void);
-void babl_base_model_lab (void);
+void babl_base_model_rgb (void);
+void babl_base_model_gray (void);
+void babl_base_model_ycbcr (void);
+void babl_base_model_lab (void);
static void
models (void)
{
- babl_base_model_rgb (); /* must be registered first since it is the
- reference */
- babl_base_model_grayscale ();
- babl_base_model_lab ();
- babl_base_model_ycbcr ();
+ babl_base_model_rgb (); /* must be registered first since it is the
+ reference, (and contains the alpha definition) */
+ babl_base_model_gray ();
+ babl_base_model_lab ();
+ babl_base_model_ycbcr ();
}
* Boston, MA 02111-1307, USA.
*/
+/* FIXME: this file should be renamed model-gray.c */
+
#include "babl.h"
#include "util.h"
#include "rgb-constants.h"
static void models (void);
static void conversions (void);
-void babl_base_model_grayscale (void)
+void babl_base_model_gray (void)
{
components ();
models ();
components (void)
{
babl_component_new (
- "luminance",
+ "Y",
"id", BABL_LUMINANCE,
"luma",
NULL);
babl_component_new (
- "luminance-gamma2.2",
+ "Y*A",
+ "id", BABL_LUMINANCE_MUL_ALPHA,
+ "luma",
+ NULL);
+
+ babl_component_new (
+ "Y-g2.2",
"id", BABL_LUMINANCE_GAMMA_2_2,
"luma",
NULL);
models (void)
{
babl_model_new (
- "grayscale",
- "id", BABL_GRAYSCALE,
+ "gray",
+ "id", BABL_GRAY,
babl_component_id (BABL_LUMINANCE),
NULL);
babl_model_new (
- "grayscale-gamma2.2",
- "id", BABL_GRAYSCALE_GAMMA_2_2,
- babl_component_id (BABL_LUMINANCE),
+ "gray-g2.2",
+ "id", BABL_GRAY_GAMMA_2_2,
+ babl_component_id (BABL_LUMINANCE_GAMMA_2_2),
NULL);
babl_model_new (
- "grayscale-alpha",
- "id", BABL_GRAYSCALE_ALPHA,
+ "graya-g2.2",
+ "id", BABL_GRAY_GAMMA_2_2_ALPHA,
+ babl_component_id (BABL_LUMINANCE_GAMMA_2_2),
+ babl_component_id (BABL_ALPHA),
+ NULL);
+
+ babl_model_new (
+ "graya",
+ "id", BABL_GRAY_ALPHA,
babl_component_id (BABL_LUMINANCE),
babl_component_id (BABL_ALPHA),
NULL);
babl_model_new (
- "grayscale-alpha-premultiplied",
- "id", BABL_GRAYSCALE_ALPHA_PREMULTIPLIED,
+ "grayA",
+ "id", BABL_GRAY_ALPHA_PREMULTIPLIED,
babl_component_id (BABL_LUMINANCE_MUL_ALPHA),
babl_component_id (BABL_ALPHA),
NULL);
static void
-rgb_to_grayscale (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+rgb_to_gray (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
static void
-rgb_to_grayscale_2_2 (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+rgb_to_gray_2_2 (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
static void
-grayscale_2_2_to_rgb (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+gray_2_2_to_rgb (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
static void
-grayscale_to_rgb (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+gray_to_rgb (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
}
static void
-grayscale_alpha_premultiplied_to_rgba (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+gray_alpha_premultiplied_to_rgba (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
assert (src_bands == 2);
static void
-rgba_to_grayscale_alpha_premultiplied (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+rgba_to_gray_alpha_premultiplied (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY;
assert (src_bands == 4);
conversions (void)
{
babl_conversion_new (
- "babl-base: grayscale-gamma2.2 to rgba",
- "source", babl_model_id (BABL_GRAYSCALE_GAMMA_2_2),
+ "babl-base: gray-g2.2 to rgba",
+ "source", babl_model_id (BABL_GRAY_GAMMA_2_2),
+ "destination", babl_model_id (BABL_RGBA),
+ "planar", gray_2_2_to_rgb,
+ NULL
+ );
+
+
+ babl_conversion_new (
+ "babl-base: rgba to gray-g2.2",
+ "source", babl_model_id (BABL_RGBA),
+ "destination", babl_model_id (BABL_GRAY_GAMMA_2_2),
+ "planar", rgb_to_gray_2_2,
+ NULL
+ );
+
+ babl_conversion_new (
+ "babl-base: graya-g2.2 to rgba",
+ "source", babl_model_id (BABL_GRAY_GAMMA_2_2_ALPHA),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_2_2_to_rgb,
+ "planar", gray_2_2_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale-gamma2.2",
+ "babl-base: rgba to graya-g2.2",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE_GAMMA_2_2),
- "planar", rgb_to_grayscale_2_2,
+ "destination", babl_model_id (BABL_GRAY_GAMMA_2_2_ALPHA),
+ "planar", rgb_to_gray_2_2,
NULL
);
babl_conversion_new (
- "babl-base: grayscale to rgba",
- "source", babl_model_id (BABL_GRAYSCALE),
+ "babl-base: gray to rgba",
+ "source", babl_model_id (BABL_GRAY),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: grayscale to rgb",
- "source", babl_model_id (BABL_GRAYSCALE),
+ "babl-base: gray to rgb",
+ "source", babl_model_id (BABL_GRAY),
"destination", babl_model_id (BABL_RGB),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha to rgba",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA),
+ "babl-base: gray-alpha to rgba",
+ "source", babl_model_id (BABL_GRAY_ALPHA),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha to rgb",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA),
+ "babl-base: gray-alpha to rgb",
+ "source", babl_model_id (BABL_GRAY_ALPHA),
"destination", babl_model_id (BABL_RGB),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale-alpha",
+ "babl-base: rgba to gray-alpha",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY_ALPHA),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale",
+ "babl-base: rgba to gray",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: rgb to grayscale-alpha",
+ "babl-base: rgb to gray-alpha",
"source", babl_model_id (BABL_RGB),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY_ALPHA),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: rgb to grayscale",
+ "babl-base: rgb to gray",
"source", babl_model_id (BABL_RGB),
- "destination", babl_model_id (BABL_GRAYSCALE),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha to grayscale-alpha-premultiplied",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
+ "babl-base: gray-alpha to gray-alpha-premultiplied",
+ "source", babl_model_id (BABL_GRAY_ALPHA),
+ "destination", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
"planar", non_premultiplied_to_premultiplied,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha-premultuplied to grayscale-alpha",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA),
+ "babl-base: gray-alpha-premultuplied to gray-alpha",
+ "source", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
+ "destination", babl_model_id (BABL_GRAY_ALPHA),
"planar", premultiplied_to_non_premultiplied,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha-premultiplied to rgba",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
+ "babl-base: gray-alpha-premultiplied to rgba",
+ "source", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_alpha_premultiplied_to_rgba,
+ "planar", gray_alpha_premultiplied_to_rgba,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale-alpha-premultiplied",
+ "babl-base: rgba to gray-alpha-premultiplied",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
- "planar", rgba_to_grayscale_alpha_premultiplied,
+ "destination", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
+ "planar", rgba_to_gray_alpha_premultiplied,
NULL
);
}
* Boston, MA 02111-1307, USA.
*/
+/* FIXME: this file should be renamed model-gray.c */
+
#include "babl.h"
#include "util.h"
#include "rgb-constants.h"
static void models (void);
static void conversions (void);
-void babl_base_model_grayscale (void)
+void babl_base_model_gray (void)
{
components ();
models ();
components (void)
{
babl_component_new (
- "luminance",
+ "Y",
"id", BABL_LUMINANCE,
"luma",
NULL);
babl_component_new (
- "luminance-gamma2.2",
+ "Y*A",
+ "id", BABL_LUMINANCE_MUL_ALPHA,
+ "luma",
+ NULL);
+
+ babl_component_new (
+ "Y-g2.2",
"id", BABL_LUMINANCE_GAMMA_2_2,
"luma",
NULL);
models (void)
{
babl_model_new (
- "grayscale",
- "id", BABL_GRAYSCALE,
+ "gray",
+ "id", BABL_GRAY,
babl_component_id (BABL_LUMINANCE),
NULL);
babl_model_new (
- "grayscale-gamma2.2",
- "id", BABL_GRAYSCALE_GAMMA_2_2,
- babl_component_id (BABL_LUMINANCE),
+ "gray-g2.2",
+ "id", BABL_GRAY_GAMMA_2_2,
+ babl_component_id (BABL_LUMINANCE_GAMMA_2_2),
NULL);
babl_model_new (
- "grayscale-alpha",
- "id", BABL_GRAYSCALE_ALPHA,
+ "graya-g2.2",
+ "id", BABL_GRAY_GAMMA_2_2_ALPHA,
+ babl_component_id (BABL_LUMINANCE_GAMMA_2_2),
+ babl_component_id (BABL_ALPHA),
+ NULL);
+
+ babl_model_new (
+ "graya",
+ "id", BABL_GRAY_ALPHA,
babl_component_id (BABL_LUMINANCE),
babl_component_id (BABL_ALPHA),
NULL);
babl_model_new (
- "grayscale-alpha-premultiplied",
- "id", BABL_GRAYSCALE_ALPHA_PREMULTIPLIED,
+ "grayA",
+ "id", BABL_GRAY_ALPHA_PREMULTIPLIED,
babl_component_id (BABL_LUMINANCE_MUL_ALPHA),
babl_component_id (BABL_ALPHA),
NULL);
static void
-rgb_to_grayscale (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+rgb_to_gray (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
static void
-rgb_to_grayscale_2_2 (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+rgb_to_gray_2_2 (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
static void
-grayscale_2_2_to_rgb (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+gray_2_2_to_rgb (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
static void
-grayscale_to_rgb (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+gray_to_rgb (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
while (n--)
}
static void
-grayscale_alpha_premultiplied_to_rgba (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+gray_alpha_premultiplied_to_rgba (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY
assert (src_bands == 2);
static void
-rgba_to_grayscale_alpha_premultiplied (int src_bands,
- void **src,
- int *src_pitch,
- int dst_bands,
- void **dst,
- int *dst_pitch,
- int n)
+rgba_to_gray_alpha_premultiplied (int src_bands,
+ void **src,
+ int *src_pitch,
+ int dst_bands,
+ void **dst,
+ int *dst_pitch,
+ int n)
{
BABL_PLANAR_SANITY;
assert (src_bands == 4);
conversions (void)
{
babl_conversion_new (
- "babl-base: grayscale-gamma2.2 to rgba",
- "source", babl_model_id (BABL_GRAYSCALE_GAMMA_2_2),
+ "babl-base: gray-g2.2 to rgba",
+ "source", babl_model_id (BABL_GRAY_GAMMA_2_2),
+ "destination", babl_model_id (BABL_RGBA),
+ "planar", gray_2_2_to_rgb,
+ NULL
+ );
+
+
+ babl_conversion_new (
+ "babl-base: rgba to gray-g2.2",
+ "source", babl_model_id (BABL_RGBA),
+ "destination", babl_model_id (BABL_GRAY_GAMMA_2_2),
+ "planar", rgb_to_gray_2_2,
+ NULL
+ );
+
+ babl_conversion_new (
+ "babl-base: graya-g2.2 to rgba",
+ "source", babl_model_id (BABL_GRAY_GAMMA_2_2_ALPHA),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_2_2_to_rgb,
+ "planar", gray_2_2_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale-gamma2.2",
+ "babl-base: rgba to graya-g2.2",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE_GAMMA_2_2),
- "planar", rgb_to_grayscale_2_2,
+ "destination", babl_model_id (BABL_GRAY_GAMMA_2_2_ALPHA),
+ "planar", rgb_to_gray_2_2,
NULL
);
babl_conversion_new (
- "babl-base: grayscale to rgba",
- "source", babl_model_id (BABL_GRAYSCALE),
+ "babl-base: gray to rgba",
+ "source", babl_model_id (BABL_GRAY),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: grayscale to rgb",
- "source", babl_model_id (BABL_GRAYSCALE),
+ "babl-base: gray to rgb",
+ "source", babl_model_id (BABL_GRAY),
"destination", babl_model_id (BABL_RGB),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha to rgba",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA),
+ "babl-base: gray-alpha to rgba",
+ "source", babl_model_id (BABL_GRAY_ALPHA),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha to rgb",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA),
+ "babl-base: gray-alpha to rgb",
+ "source", babl_model_id (BABL_GRAY_ALPHA),
"destination", babl_model_id (BABL_RGB),
- "planar", grayscale_to_rgb,
+ "planar", gray_to_rgb,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale-alpha",
+ "babl-base: rgba to gray-alpha",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY_ALPHA),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale",
+ "babl-base: rgba to gray",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: rgb to grayscale-alpha",
+ "babl-base: rgb to gray-alpha",
"source", babl_model_id (BABL_RGB),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY_ALPHA),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: rgb to grayscale",
+ "babl-base: rgb to gray",
"source", babl_model_id (BABL_RGB),
- "destination", babl_model_id (BABL_GRAYSCALE),
- "planar", rgb_to_grayscale,
+ "destination", babl_model_id (BABL_GRAY),
+ "planar", rgb_to_gray,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha to grayscale-alpha-premultiplied",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
+ "babl-base: gray-alpha to gray-alpha-premultiplied",
+ "source", babl_model_id (BABL_GRAY_ALPHA),
+ "destination", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
"planar", non_premultiplied_to_premultiplied,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha-premultuplied to grayscale-alpha",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA),
+ "babl-base: gray-alpha-premultuplied to gray-alpha",
+ "source", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
+ "destination", babl_model_id (BABL_GRAY_ALPHA),
"planar", premultiplied_to_non_premultiplied,
NULL
);
babl_conversion_new (
- "babl-base: grayscale-alpha-premultiplied to rgba",
- "source", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
+ "babl-base: gray-alpha-premultiplied to rgba",
+ "source", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
"destination", babl_model_id (BABL_RGBA),
- "planar", grayscale_alpha_premultiplied_to_rgba,
+ "planar", gray_alpha_premultiplied_to_rgba,
NULL
);
babl_conversion_new (
- "babl-base: rgba to grayscale-alpha-premultiplied",
+ "babl-base: rgba to gray-alpha-premultiplied",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_GRAYSCALE_ALPHA_PREMULTIPLIED),
- "planar", rgba_to_grayscale_alpha_premultiplied,
+ "destination", babl_model_id (BABL_GRAY_ALPHA_PREMULTIPLIED),
+ "planar", rgba_to_gray_alpha_premultiplied,
NULL
);
}
components (void)
{
babl_component_new (
- "L",
+ "CIE L",
"id", BABL_LAB_L,
"luma",
NULL);
babl_component_new (
- "a",
+ "CIE a",
"id", BABL_LAB_A,
"chroma",
NULL);
babl_component_new (
- "b",
+ "CIE b",
"id", BABL_LAB_B,
"chroma",
NULL);
static void
pixel_formats (void)
{
+ babl_pixel_format_new (
+ "lab-float",
+ "id", BABL_LAB_FLOAT,
+ babl_model_id (BABL_LAB),
+ babl_type_id (BABL_FLOAT),
+ babl_component_id (BABL_LAB_L),
+ babl_component_id (BABL_LAB_A),
+ babl_component_id (BABL_LAB_B),
+ NULL);
}
components (void)
{
babl_component_new (
- "red",
+ "R",
"id", BABL_RED,
"luma",
"chroma",
NULL);
babl_component_new (
- "green",
+ "G",
"id", BABL_GREEN,
"luma",
"chroma",
NULL);
babl_component_new (
- "blue",
+ "B",
"id", BABL_BLUE,
"luma",
"chroma",
NULL);
babl_component_new (
- "red-gamma2.2",
+ "R-g2.2",
"id", BABL_RED_GAMMA_2_2,
"luma",
"chroma",
NULL);
babl_component_new (
- "green-gamma2.2",
+ "G-g2.2",
"id", BABL_GREEN_GAMMA_2_2,
"luma",
"chroma",
NULL);
babl_component_new (
- "blue-gamma2.2",
+ "B-g2.2",
"id", BABL_BLUE_GAMMA_2_2,
"luma",
"chroma",
babl_component_new (
- "alpha",
+ "A",
"id", BABL_ALPHA,
"alpha",
NULL);
babl_component_new (
- "red*alpha",
+ "R*A",
"id", BABL_RED_MUL_ALPHA,
"luma",
"chroma",
"alpha",
NULL);
babl_component_new (
- "green*alpha",
+ "G*A",
"id", BABL_GREEN_MUL_ALPHA,
"luma",
"chroma",
"alpha",
NULL);
babl_component_new (
- "blue*alpha",
+ "B*A",
"id", BABL_BLUE_MUL_ALPHA,
"luma",
"chroma",
"alpha",
NULL);
- babl_component_new (
- "luminance*alpha",
- "id", BABL_LUMINANCE_MUL_ALPHA,
- "luma",
- NULL);
}
static void
NULL);
babl_model_new (
- "rgb-gamma2.2",
+ "rgb-g2.2",
"id", BABL_RGB_GAMMA_2_2,
babl_component_id (BABL_RED_GAMMA_2_2),
babl_component_id (BABL_GREEN_GAMMA_2_2),
NULL);
babl_model_new (
- "rgba-gamma2.2",
+ "rgba-g2.2",
"id", BABL_RGBA_GAMMA_2_2,
babl_component_id (BABL_RED_GAMMA_2_2),
babl_component_id (BABL_GREEN_GAMMA_2_2),
);
babl_conversion_new (
- "babl-base: rgba to rgb-gamma2.2",
+ "babl-base: rgba to rgb-g2.2",
"source", babl_model_id (BABL_RGBA),
"destination", babl_model_id (BABL_RGB_GAMMA_2_2),
"planar", g3_gamma_2_2,
);
babl_conversion_new (
- "babl-base: rgba to rgba-gamma2.2",
+ "babl-base: rgba to rgba-g2.2",
"source", babl_model_id (BABL_RGBA),
"destination", babl_model_id (BABL_RGBA_GAMMA_2_2),
"planar", g3_gamma_2_2,
);
babl_conversion_new (
- "babl-base: rgb-gamma2.2 to rgba",
+ "babl-base: rgb-g2.2 to rgba",
"source", babl_model_id (BABL_RGB_GAMMA_2_2),
"destination", babl_model_id (BABL_RGBA),
"planar", g3_inv_gamma_2_2,
);
babl_conversion_new (
- "babl-base: rgba-gamma2.2 to rgba",
+ "babl-base: rgba-g2.2 to rgba",
"source", babl_model_id (BABL_RGBA_GAMMA_2_2),
"destination", babl_model_id (BABL_RGBA),
"planar", g3_inv_gamma_2_2,
components (void)
{
babl_component_new (
- "cb",
+ "Cb",
"id", BABL_CB,
"chroma",
NULL);
babl_component_new (
- "cr",
+ "Cr",
"id", BABL_CR,
"chroma",
NULL);
babl_model_new (
"ycbcra",
- "id", BABL_YCBCRA,
+ "id", BABL_YCBCR_ALPHA,
babl_component_id (BABL_LUMINANCE_GAMMA_2_2),
babl_component_id (BABL_CB),
babl_component_id (BABL_CR),
babl_conversion_new (
"babl-base: rgba to ycbcra",
"source", babl_model_id (BABL_RGBA),
- "destination", babl_model_id (BABL_YCBCRA),
+ "destination", babl_model_id (BABL_YCBCR_ALPHA),
"planar", rgb_to_ycbcr,
NULL
);
babl_conversion_new (
"babl-base: ycbcra to rgba",
- "source", babl_model_id (BABL_YCBCRA),
+ "source", babl_model_id (BABL_YCBCR_ALPHA),
"destination", babl_model_id (BABL_RGBA),
"planar", ycbcr_to_rgb,
NULL
fish = babl_fish (
babl_pixel_format_new (
"foo",
- babl_model ("grayscale"),
+ babl_model ("gray"),
babl_type ("float"),
- babl_component ("luminance"),
+ babl_component ("Y"),
NULL
),
babl_pixel_format_new (
"bar",
- babl_model ("grayscale"),
+ babl_model ("gray"),
babl_type ("u8"),
- babl_component ("luminance"),
+ babl_component ("Y"),
NULL
));
fish = babl_fish (
babl_pixel_format_new (
"foo",
- babl_model ("grayscale"),
+ babl_model ("gray"),
babl_type ("float"),
- babl_component ("luminance"),
+ babl_component ("Y"),
NULL
),
babl_pixel_format_new (
"bar",
babl_model ("rgb"),
babl_type ("float"),
- babl_component ("red"),
- babl_component ("green"),
- babl_component ("blue"),
+ babl_component ("R"),
+ babl_component ("G"),
+ babl_component ("B"),
NULL
)
);
"foo",
babl_model ("rgb"),
babl_type ("float"),
- babl_component ("red"),
- babl_component ("green"),
- babl_component ("blue"),
+ babl_component ("R"),
+ babl_component ("G"),
+ babl_component ("B"),
NULL
),
babl_pixel_format_new (
"bar",
babl_model ("CIE Lab"),
babl_type ("float"),
- babl_component ("L"),
- babl_component ("a"),
- babl_component ("b"),
+ babl_component ("CIE L"),
+ babl_component ("CIE a"),
+ babl_component ("CIE b"),
NULL
)
);
"foo",
babl_model ("rgb"),
babl_type ("float"),
- babl_component ("red"),
- babl_component ("green"),
- babl_component ("blue"),
+ babl_component ("R"),
+ babl_component ("G"),
+ babl_component ("B"),
NULL
),
babl_pixel_format_new (
"bar",
babl_model ("ycbcr"),
babl_type ("float"),
- babl_component ("luminance"),
- babl_component ("cb"),
- babl_component ("cr"),
+ babl_component ("Y"),
+ babl_component ("Cb"),
+ babl_component ("Cr"),
NULL
)
);
"foo",
babl_model ("rgb"),
babl_type ("float"),
- babl_component ("red"),
- babl_component ("green"),
- babl_component ("blue"),
+ babl_component ("R"),
+ babl_component ("G"),
+ babl_component ("B"),
NULL
),
babl_pixel_format_new (
"bar",
babl_model ("ycbcr"),
babl_type ("float"),
- babl_component ("luminance"),
- babl_component ("cb"),
- babl_component ("cr"),
+ babl_component ("Y"),
+ babl_component ("Cb"),
+ babl_component ("Cr"),
NULL
)
);
fish = babl_fish (
babl_pixel_format_new (
"foo",
- babl_model ("grayscale"),
+ babl_model ("gray"),
babl_type ("u8"),
- babl_component ("luminance"),
+ babl_component ("Y"),
NULL
),
babl_pixel_format_new (
"bar",
- babl_model ("grayscale"),
+ babl_model ("gray"),
babl_type ("float"),
- babl_component ("luminance"),
+ babl_component ("Y"),
NULL
));